Skip to content

fix(ui): redirect to /blog when post not found in Edit page (#307)#308

Closed
mpaulosky wants to merge 1 commit into
devfrom
squad/307-fix-edit-null-post-redirect
Closed

fix(ui): redirect to /blog when post not found in Edit page (#307)#308
mpaulosky wants to merge 1 commit into
devfrom
squad/307-fix-edit-null-post-redirect

Conversation

@mpaulosky

Copy link
Copy Markdown
Owner

Summary

Fixes a bug where Edit.razor would show an infinite 'Loading...' spinner when the requested blog post does not exist.

Root Cause

GetBlogPostByIdQuery returns Result.Ok<BlogPostDto?>(null) when a post is not found (success with null value). The OnParametersSetAsync handler set _model = null in this path and left _error as null. The template's @if (_model is null && _error is null) then rendered 'Loading...' indefinitely.

This was identified in the Copilot review of PR #304 but missed before merge.

Changes

  • Edit.razor: null-value branch now calls Navigation.NavigateTo("/blog") and returns, consistent with the non-owner/non-admin redirect
  • EditAclTests.cs: added EditRedirectsToBlogWhenPostNotFound bUnit test covering Result.Ok(null) path

Tests

  • 89/89 bUnit tests pass ✅
  • 154/154 unit tests pass ✅

Closes #307

…t test

- Edit.razor: null-value branch now navigates to /blog instead of
  leaving _model null (which caused infinite 'Loading...' state)
- EditAclTests: added EditRedirectsToBlogWhenPostNotFound covering
  the Result.Ok(null) path

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 11, 2026 21:03
@github-actions

Copy link
Copy Markdown
Contributor

🏗️ PR Added to Squad Triage Queue

This PR has been labeled with squad and added to the triage queue.

Next steps:

  • The squad Lead will review and assign to an appropriate team member
  • A squad:member label will be added after triage

If you know which squad member should handle this, you can add the appropriate squad:member label yourself.

@github-actions github-actions Bot added the squad Squad triage inbox — Lead will assign to a member label May 11, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a UX bug in the blog post Edit page where a missing post (Result.Ok(null)) could leave the UI stuck in the “Loading...” state by redirecting to /blog instead, and adds a bUnit regression test to cover that path.

Changes:

  • Redirect to /blog when GetBlogPostByIdQuery succeeds but returns a null post in Edit.razor.
  • Add bUnit test EditRedirectsToBlogWhenPostNotFound to validate the redirect behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/Web/Features/BlogPosts/Edit/Edit.razor Redirects away from the Edit page when the requested post is not found.
tests/Web.Tests.Bunit/Features/EditAclTests.cs Adds coverage for the “success-but-null post” redirect case.

Comment on lines 87 to 91
else
{
_model = null;
Navigation.NavigateTo("/blog");
return;
}
@github-actions

Copy link
Copy Markdown
Contributor

Test Results Summary

362 tests  +1   361 ✅ +1   19s ⏱️ -1s
  6 suites ±0     1 💤 ±0 
  6 files   ±0     0 ❌ ±0 

Results for commit 8c7b15f. ± Comparison against base commit 7e15cdd.

@codecov

codecov Bot commented May 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.50%. Comparing base (7e15cdd) to head (8c7b15f).

Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #308      +/-   ##
==========================================
+ Coverage   83.33%   83.50%   +0.17%     
==========================================
  Files          47       47              
  Lines        1248     1249       +1     
  Branches      152      152              
==========================================
+ Hits         1040     1043       +3     
+ Misses        148      147       -1     
+ Partials       60       59       -1     
Files with missing lines Coverage Δ
src/Web/Features/BlogPosts/Edit/Edit.razor 86.48% <100.00%> (+5.93%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mpaulosky

Copy link
Copy Markdown
Owner Author

Triage Decision: SUPERSEDED — Close as Duplicate

Status: ⚠️ This PR duplicates changes already in PR #306

Analysis:

Recommendation:
Close PR #308 without merging. The UI bug fix will ship via PR #306 (which is ready for review). Both issues (#305 and #307) will be resolved by merging PR #306.

@mpaulosky

Copy link
Copy Markdown
Owner Author

Closing as a duplicate of #306 per triage.

@mpaulosky mpaulosky closed this May 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

squad Squad triage inbox — Lead will assign to a member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(ui): redirect to /blog when post not found in Edit page (null-value stuck loading)

2 participants